/*
 * @FilePath: index.ts
 * @Author: liuqiong
 * @Date: 2023-09-09 08:54:32
 * @LastEditors: liuqiong
 * @LastEditTime: 2023-10-16 11:07:09
 * @Description: 
 */
import { createRouter, createWebHistory } from 'vue-router'
import { start, close } from '@/utils/nprogress'
import routes from './routes'
import { setItem } from '@/utils'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

router.beforeEach((to, from) => {
  setItem('routepath', to.path)
  start()
})

router.afterEach(() => {
  close()
})

export default router